首页 \ 问答 \ Virtualenv不适用于RedHat(Virtualenv doesn't work on RedHat)

Virtualenv不适用于RedHat(Virtualenv doesn't work on RedHat)

我试图找出为什么我不能在RedHat上创建virtualenv。 这是我的命令行:

python /opt/rh/python27/root/usr/bin/virtualenv-2.7 -p /opt/rh/python27/ /home/myuser/tpa/

/opt/rh/python27/root/usr/bin/virtualenv-2.7 : Is here to setup the version of virtualenv that I want to use

-p /opt/rh/python27/  : To setup the version of python I want to use

/home/myuser/tpa/ : My directory where the virtualenv will be stored

但我得到以下内容:

Traceback (most recent call last):
  File "/opt/rh/python27/root/usr/bin/virtualenv-2.7", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2603, in <module>
  File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 666, in require
  File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: virtualenv==1.10.1

你有什么主意吗? 谢谢


I'm trying to figure out why I cannot create a virtualenv on RedHat. Here's my command line :

python /opt/rh/python27/root/usr/bin/virtualenv-2.7 -p /opt/rh/python27/ /home/myuser/tpa/

.

/opt/rh/python27/root/usr/bin/virtualenv-2.7 : Is here to setup the version of virtualenv that I want to use

-p /opt/rh/python27/  : To setup the version of python I want to use

/home/myuser/tpa/ : My directory where the virtualenv will be stored

But I get the following :

Traceback (most recent call last):
  File "/opt/rh/python27/root/usr/bin/virtualenv-2.7", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2603, in <module>
  File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 666, in require
  File "/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: virtualenv==1.10.1

Do you have any idea? Thanks


原文:https://stackoverflow.com/questions/37530575
更新时间:2023-05-07 17:05

最满意答案

我认为你的输出应该是“一些随机字符串”,因为你的两行代码什么都不做,请参阅注释。

int main(){
   char token[] = "some random string";
   char c[23];  
   strcpy( c, token);
   strncpy(c, token, 5);  // Does nothing
   c[strlen(c)] = '\0';   // Does nothing
   cout<<c;
   return 0 ;
}

如果要输出“some”,可以这样做:

strncpy(c, token, 5);
c[5] = '\0';

strncpy()不会自动向dest字符串添加尾部'\ 0'。 如果源字符串长度大于len(strncpy的第三个参数),则len字符复制到dest而不尾随'\ 0'。 所以你必须通过代码显式地给出一个尾随'\ 0'。


I think your output should be "some random string", because your two lines of code do nothing, see the comment.

int main(){
   char token[] = "some random string";
   char c[23];  
   strcpy( c, token);
   strncpy(c, token, 5);  // Does nothing
   c[strlen(c)] = '\0';   // Does nothing
   cout<<c;
   return 0 ;
}

If you want to output "some", you could do this:

strncpy(c, token, 5);
c[5] = '\0';

strncpy() doesn't automatically add trailing '\0' to dest string. If the source string length is bigger than len (3rd argument of strncpy), then len characters copied to dest without trailing '\0'. So you have to give a trailing '\0' explicitly by code.

相关问答

更多
  • 将其更改为: $(this).addClass("active"); jsFiddle例子 .addClass()是一种jQuery方法,您一直试图将它应用于非jQuery对象(vs vs $(this) )。 Change it to: $(this).addClass("active"); jsFiddle example .addClass() is a jQuery method and you had been trying to apply it to a non-jQuery object ...
  • $.fn.get与$.fn.map一起使用时,返回一个没有addClass和更多jQuery方法的HTMLElement 。 所以你必须使用eq进行以下操作(或者:first根据你的需要) $('.a').eq(0).addClass('g'); // assuming you want first .a 如果你想要一种本地的方式(出于一些奇怪的原因)那么你就可以做到 $('.a').get(0).className += " g"; // space is important -------^ $.f ...
  • ToList()不能返回null但是空列表: if (_getData.Any()) { foreach (var e in _getData) { // some logic here to update the event etc } } else { // some logic to create an event } ToList() can't return null but empty list: if (_getData.Any()) { fore ...
  • 我认为你的输出应该是“一些随机字符串”,因为你的两行代码什么都不做,请参阅注释。 int main(){ char token[] = "some random string"; char c[23]; strcpy( c, token); strncpy(c, token, 5); // Does nothing c[strlen(c)] = '\0'; // Does nothing cout<
  • 对于延迟回复此事,我深表歉意。 要记住的一件事是WaitUntilReady正在监视浏览器的“Ready”标志。 一旦浏览器完成主HTML页面(例如MyPage.html)以及任何引用的资源(图像,css文件,js文件等),就会设置此标志。 它没有考虑在加载页面后由于JavaScript获得控制而启动的任何Ajax回发。 Ajax Postbacks(通常在从Web服务器获取数据时通过某种类型的旋转圆圈直观显示)可能导致在WaitUntilReady将控制权返回到测试代码后很长时间内修改DOM。 如果设置执 ...
  • 这样做,因为appendTo是一个新的选择器,可以包含页面中的任何内容。 所以你在页面中选择了所有H4并将它们添加到LI h3中。 $('#calendar-feed li.event').each(function() { $(this).find('h3').appendTo($(this).find('h4')); }); Do this, because the appendTo is a new selector which can contain anything within the ...
  • 正如@jarlh建议的那样,使用NOT EXISTS,或者在使用NOT IN时,确保从子查询中排除NULL,如下所示: SELECT n,CASE WHEN p IS NULL THEN 'Root' WHEN n NOT IN (SELECT DISTINCT p FROM BST WHERE p IS NOT NULL) THEN 'Leaf' ELSE 'Inner' END FROM BST ORDER BY ...
  • 在第一个请求中,您将获得一组消息,并将最后一个id设置为消息数组中的最后一个id。 在下一个调用中,您将获得null,因为自上一个id以来没有新消息,因此没有任何内容可以迭代,最后一个id重置为-1,并且该过程重复进行。 如果data为null您应该不做任何事情。 一旦有新消息, data将不再为null并且$.each将运行,将任何新消息附加到消息框。 if (!data) { return; } var tmp = -1; $.each(data, ... 通过此更改,第一次运行将查找消息, data ...
  • 试试以下: WebDriverWait wait = new WebDriverWait(dr, 30); wait.until(ExpectedConditions.jsReturnsValue("return document.readyState==\"complete\";")); void waitForLoad(WebDriver driver) { ExpectedCondition pageLoadCondition = new ExpectedC ...
  • 这听起来像编译器的问题。 我假设你正在使用你的标签,因为你所描述的听起来像预期的行为。 你是如何编译你的少? This sounds like a problem with your compiler. I'm assuming from your tags that you're using, as what you're describing sounds like expected behavior. How are you compiling your less?

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。