小编chr*_*ris的帖子

有人可以解释这里的实际错误以及如何解决它?

我试图在嵌套的for/foreach循环中使用哈希.见源

strict它说

Global symbol "$mapping" requires explicit package name at ./test2.pl line 39. 
Execution of ./test2.pl aborted due to compilation errors.
Run Code Online (Sandbox Code Playgroud)

没有strict,

Use of uninitialized value $mapping in hash element at ./test2.pl line 46, <$fh> line 8. 
Use of uninitialized value in concatenation (.) or string at ./test2.pl line 46, <$fh> line 8.
Run Code Online (Sandbox Code Playgroud)

print $hashref->{$mapping} 在输出中为空.

错误是什么?

perl hash loops

2
推荐指数
1
解决办法
142
查看次数

在virtualenv中找不到Python模块

我试过安装一个python模块:

virtualenv .
source bin/activate
pip install utmp
Run Code Online (Sandbox Code Playgroud)

似乎安装:

(wtmp)chris@chris-nb:~/computer/wtmp$ find -iname utmp
./bin/utmp
./lib/python2.7/site-packages/utmp
Run Code Online (Sandbox Code Playgroud)

但Python说没找到:

(wtmp)chris@chris-nb:~/computer/wtmp$ ./wtmp.py
Traceback (most recent call last):
  File "./wtmp.py", line 3, in <module>
    import utmp
ImportError: No module named utmp
Run Code Online (Sandbox Code Playgroud)

这是模块问题吗?我做错什么了吗?

如果重要,操作系统就是Ubuntu.

这是重新安装日志:

(wtmp)chris@chris-nb:~/computer/wtmp$ pip install --upgrade --no-deps --force-reinstall utmp
Downloading/unpacking utmp
  Downloading utmp-0.4.tar.gz
  Running setup.py (path:/home/chris/computer/wtmp/build/utmp/setup.py) egg_info for package utmp
    zip_safe flag not set; analyzing archive contents...
    flake8.reporter: module references __file__
    flake8.tests._test_warnings: module references __file__
    flake8.tests.test_integration: module references __file__

    Installed /home/chris/computer/wtmp/build/utmp/flake8-2.4.1-py2.7.egg
    Searching for …
Run Code Online (Sandbox Code Playgroud)

python module pip virtualenv python-2.7

1
推荐指数
2
解决办法
1万
查看次数

标签 统计

hash ×1

loops ×1

module ×1

perl ×1

pip ×1

python ×1

python-2.7 ×1

virtualenv ×1